package system

import "gorm.io/gorm"

type Dept struct {
	gorm.Model
	Deptname     string  `gorm:"type:varchar(20);not null;unique" json:"username"`
	Type         string  `gorm:"type:varchar(20);not null comment:'1公司, 2分公司, 3部门'" json:"type"`
	ParentId     int     `gorm:"type:int(3)" json:"parentId"`
	Remark       *string `gorm:"type:varchar(100)" json:"remark"`
	Sort         int     `gorm:"type:int(16)" json:"sort"`
	LeaderUserId *int    `gorm:"type:int(16)" json:"leaderUserId"`
	Phone        int     `gorm:"type:int(16)" json:"phone"`
	Email        *string `gorm:"type:varchar(20)" json:"email"`
	Status       uint    `gorm:"type:tinyint(1);default:1;comment:'1正常, 2禁用'" json:"status"`
	Creator      string  `gorm:"type:varchar(20);" json:"creator"`
	Users        []*User `gorm:"foreignkey:id" json:"users"`
	Roles        []*Role `gorm:"many2many:role_depts" json:"roles"`
}
